# -*- encoding: utf-8 -*-
"""
@version: 1.0
@author: yang ming
@contact: 122162005@qq.com
@site: http://www.idianjia.com/
@software: PyCharm
@file: serializers.py
@time: 2016/3/28 10:01
"""
from rest_framework import serializers
from app.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES


class SnippetSerializer(serializers.Serializer):
    pk = serializers.IntegerField(read_only=True)
    title = serializers.CharField(required=False, allow_blank=True, max_length=100)
    code = serializers.CharField(style={'base_template': 'textarea.html'})
    linenos = serializers.BooleanField(required=False)
    language = serializers.CharField(choices=LANGUAGE_CHOICES, default='python')
    style = serializers.ChoiceField(choices=STYLE_CHOICES, default='friendly')

    def create(self, ):
        pass
